#! /bin/sh


# make sure parameters were given
if [ "$1" = "" ]
then
	echo "usage: $0 \"directory name\""
	say "you fail at life"
	exit
fi


# todo: build schema in yaml

# todo: prompt for all the right paramters
# should the script work on a prompt basis or just require initial parameters?
# sudo -p "Please enter your: " date 2>/dev/null 1>&2

# setup vars
work="Work"
svn = "??"

if [ "$2" != "" ]
then
	echo "using Work/Client/Project structure format"
	# try to create folders (they may exist)
	svn mkdir http://yourrepo//$work/$1 -m "Initial creation of client directory: $1"
	svn mkdir http://yourrepo//$work/$1/$2 -m "Initial creation of project directory: $2"
	svn mkdir http://yourrepo//$work/$1/$2/{01_assets,02_source,03_docs,04_web} -m "Initial creation of project directory structure: $1/$2/$structure"

	# checkout working copy
	svn checkout http://yourrepo//$work/$1/$2 ~/Work/$1/$2


else
	echo "using Work/Project structure format"
	# try to create folders (they may exist)
	svn mkdir http://yourrepo//$work/$1 -m "Initial creation of project directory: $1"
	svn mkdir http://yourrepo//$work/$1/{01_assets,02_source,03_docs,04_web} -m "Initial creation of project directory structure: $1/$2/$structure"
	
	# checkout working copy
	svn checkout http://yourrepo//$work/$1 ~/Work/$1
	
fi


say "you win, have a beer"